package test_3_13;

import java.util.Scanner;

public class six {
    public static void main(String[] args) {
        int [] nums={1,4,7,2,9,6};
        System.out.println("请输入你要找的和数：");
        Scanner sc =new Scanner(System.in);
        int sum=sc.nextInt();
        find_Sum(nums,sum);
    }
    public static void find_Sum(int []nums,int sum)
    {
        int l=0;
        int r=0;
        int count=0;
        for(int i=0;i<nums.length;i++)
        {
            l=i;
            for(int j=1;j< nums.length;j++)
            {
                r=j;
                if(nums[i]+nums[j]==sum)
                {
                    System.out.println("["+l+","+r+"]");
                    count++;
                    return;
                }
            }
        }
        if(count==0)
        {
            System.out.println("找不到");
        }

    }
}
